package server;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;

import mysql.MysqlFactory;
import tcp.TcpFactory;

public class Server {
	static String myip;
	static String TcpPort;
	static String UdpPort;

	static {

		try {
			Properties properties = new Properties();
			properties.load(new FileReader("Config.properties"));
			myip = properties.getProperty("HostIp");
			TcpPort = properties.getProperty("TcpPort");
			UdpPort = properties.getProperty("UdpPort");
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		MysqlFactory mysqlFactory = new MysqlFactory();
		mysqlFactory.creatMysql();
		TcpFactory tcpFactory = new TcpFactory();
		tcpFactory.creatServer(Integer.valueOf(TcpPort));
		TcpFactory.getServer().start();
		MysqlFactory.getMysql().delete("online", "");
		new Console().start();

	}

	

}
